
#define MIN_HEROES 5
#define MAX_HEROES 10  
#define MAX_HEROES_POOL 50
#define MAX_POOL_SIZE 50
struct GameData {
    char position[10];
    char hero[20];
    int kill;
    int death;
    int assist;
    int win;
    double kda;
    int score;
    int current_score;
    int lasthit;
	int push_tower; 
    int economy_value;
    int time_duration;
    int double_kill;
    int triple_kill;
    int quadra_kill;
    int penta_kill;
};

struct hero_usage {
    char hero[20];
    int count;
    int total_kill;
    int total_death;
    int total_assist;
    int total_win;
    double total_kda;
    int total_score;
    int total_duration;
    int total_quadrakill;
    int total_pentakill;
};

typedef struct Player{
    char name[20];
	char code[30];
	char address[30];
	double total_game_duration;
	char contact[20]; 
	struct GameData games[300];
	struct hero_usage players[MAX_HEROES_POOL];
	int hero_count;
	int current_score;
	int total_games; 
	char hero_pool[MAX_HEROES][20];  
    int hero_pool_size;        
}Player;

typedef struct Hero_Rank{
	char name[20];  
    int total_score;       
    int games_played;   
    double win_rate;
}HeroRank;

typedef struct Node{
   Player ply;
   struct hero_usage hru;
   struct Node *next;
}Node;

typedef struct List{
	Node* front;
	int size;
}List;
typedef struct Data{
	char name[20];
    int score;
    int games;
}Data;
int menu();
double sec_to_hour(int seconds);
double sec_to_minute(int seconds);
void multi_kill(struct GameData *game);
void kda(int *kill, int *death, int *assist,int win);
void choose_heroes(char heroes[MAX_HEROES][20], int *num_heroes,char HERO_POOL[][20],int pool_size);
void score_system(struct GameData *game,int win,int *score,int *current_score);	
void range_system(List *list);
void show_rank(List*list);
void hero_rank(List *list);
void economy(int *lasthit,int *kill,int *assist,int *push_tower,int *economy_value, int win);
int time_duration(int economy_value);
void generate_game_data(struct GameData games[], struct hero_usage players[], int *hero_count,int *current_score, char player_hero_pool[][20],int hero_pool_size,int total_games);
void print_game_data(struct GameData games[],int total_games);
void print_hero_usage(struct hero_usage players[], int hero_count);
void calculate_rate(int total_games,int total_win);  
void addplayer(List *list, char HERO_POOL[][20],int hero_pool_size);
void saveplayer(List *list,const char *filename );
void loadplayer(List *list,const char *filename);
void checkplayer(List*list);
void findplayer(List*list, char HERO_POOL[][20],int hero_pool_size);
void changeplayer(List*list);
void deleteplayer(List *list);
